﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace MyFeer.Lib.common
{
    public class IntegerRect
    {
        private int left;
        private int top;
        private int right;
        private int bottom;


        public IntegerRect()
        {
        }
        public IntegerRect(int left, int top, int right, int bottom)
        {
            this.left = left;
            this.top = top;
            this.right = right;
            this.bottom = bottom;
        }

        public int Left
        {
            get { return left; }
            set { left = value; }
        }
        public int Top
        {
            get { return top; }
            set { top = value; }
        }
        public int Right
        {
            get { return right; }
            set { right = value; }
        }
        public int Bottom
        {
            get { return bottom; }
            set { bottom = value; }
        }
        public int Width
        {
            get { return this.right-this.left+1;}
            set { this.right = this.left + value - 1; }
        }
        public int Height
        {
            get { return this.bottom - this.top + 1; }
            set { this.bottom = this.top + value - 1; }
        }

        public Boolean Contain(int x, int y)
        {
            if (x >= this.left && x <= this.right && y >= this.top && y <= this.bottom)
                return true;
            return false;
        }
    }
}
